Skip to content

WHERE condition parser#1

Merged
zacMode merged 7 commits into
hotdata-dev:mainfrom
lmangani:where
Jun 9, 2025
Merged

WHERE condition parser#1
zacMode merged 7 commits into
hotdata-dev:mainfrom
lmangani:where

Conversation

@lmangani

@lmangani lmangani commented Jun 4, 2025

Copy link
Copy Markdown
Contributor

Hey @zacMode 👋 Just discovered this extension and its super useful! I'm not sure if this is even compatible in intention with your roadmap (absolutely no offense if not) but were about to expose a similarly simple where parser in our chsql quackscience community extension but now it seems more appropriate to perhaps have this as part of this dedicated one, so here's a little PR + Tests extension just for discussion.

D SELECT * FROM parse_where('SELECT * FROM MyTable WHERE time > 1 AND time < 100');
┌────────────────┬────────────┬─────────┐
│   condition    │ table_name │ context │
│    varcharvarcharvarchar │
├────────────────┼────────────┼─────────┤
│ ("time" > 1)   │ MyTable    │ WHERE   │
│ ("time" < 100) │ MyTable    │ WHERE   │
└────────────────┴────────────┴─────────┘

D SELECT * FROM parse_where_detailed('SELECT * FROM MyTable WHERE time > 1 AND time < 100');
┌─────────────┬───────────────┬─────────┬────────────┬─────────┐
│ column_name │ operator_type │  value  │ table_name │ context │
│   varcharvarcharvarcharvarcharvarchar │
├─────────────┼───────────────┼─────────┼────────────┼─────────┤
│ time>1       │ MyTable    │ WHERE   │
│ time<100     │ MyTable    │ WHERE   │
└─────────────┴───────────────┴─────────┴────────────┴─────────┘

D SELECT * FROM parse_where('SELECT * FROM MyTable WHERE time BETWEEN 1 AND 100');
┌────────────────────────────┬────────────┬─────────┐
│         condition          │ table_name │ context │
│          varcharvarcharvarchar │
├────────────────────────────┼────────────┼─────────┤
│ ("time" BETWEEN 1 AND 100) │ MyTable    │ WHERE   │
└────────────────────────────┴────────────┴─────────┘

D SELECT * FROM parse_where_detailed('SELECT * FROM MyTable WHERE time BETWEEN 1 AND 100');
┌─────────────┬───────────────┬─────────┬────────────┬─────────┐
│ column_name │ operator_type │  value  │ table_name │ context │
│   varcharvarcharvarcharvarcharvarchar │
├─────────────┼───────────────┼─────────┼────────────┼─────────┤
│ time>=1       │ MyTable    │ WHERE   │
│ time<=100     │ MyTable    │ WHERE   │
└─────────────┴───────────────┴─────────┴────────────┴─────────┘

@lmangani lmangani marked this pull request as ready for review June 5, 2025 09:01
@zacMode

zacMode commented Jun 5, 2025

Copy link
Copy Markdown
Contributor

Hi @lmangani! Thanks for the contribution, this looks really cool!

I just kicked off the tests, assuming those all pass I'll get this merged

@lmangani

lmangani commented Jun 5, 2025

Copy link
Copy Markdown
Contributor Author

The changes build and pass locally using v1.3.0 as baseline, I'll check out what's wrong with the builder/action

EDIT: I see the issue is simply with the "next" builder - changes related to 1.4.0 in main which affect the existing code as well. The v1.3.0 build should pass smoothly.

@lmangani

lmangani commented Jun 9, 2025

Copy link
Copy Markdown
Contributor Author

@zacMode any thoughts or change requests?

@zacMode

zacMode commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

Apologies for the delay @lmangani ! I was hoping to have time this weekend to look into the "next build" stuff (at least to understand what it'll take to fix it), but didn't get to it.

I'll go ahead and merge and fix at a later time.

Thanks for your patience (and contribution)!

@zacMode zacMode merged commit 1d06e5c into hotdata-dev:main Jun 9, 2025
11 checks passed
@lmangani

lmangani commented Jun 9, 2025

Copy link
Copy Markdown
Contributor Author

Thanks @zacMode for accepting the PR! I'm looking forward to using the next extension release in our workflows!

zacMode added a commit to zacMode/community-extensions that referenced this pull request Jun 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants